/**
 * 
 */
package good_src.tests;

import good_src.Implementation.ConcreteCapteur;
import good_src.Implementation.ConcreteMethodRequestGet;
import good_src.Interfaces.MethodRequest;
import junit.framework.TestCase;

/**
 * @author Tangi Midy & Fabien Le Peih
 *
 */
public class TestMethodRequestGet extends TestCase {

	MethodRequest requestGet ;
	
	/**
	 * @param name
	 */
	public TestMethodRequestGet(String name) {
		super(name);
	}

	/**
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		requestGet = new ConcreteMethodRequestGet();
	}

	/**
	 * Test method for {@link good_src.Implementation.ConcreteMethodRequestGet#call()}.
	 */
	public void testCall() {
		testSetCapteur();
		assertTrue((Integer)((ConcreteMethodRequestGet) requestGet).call()==0);
		((ConcreteMethodRequestGet) requestGet).getCapteur().tick();
		assertTrue((Integer)((ConcreteMethodRequestGet) requestGet).call()==1);
	}

	/**
	 * Test method for {@link good_src.Implementation.ConcreteMethodRequestGet#setCapteur(good_src.Interfaces.Subject)}.
	 */
	public void testSetCapteur() {
		assertTrue(((ConcreteMethodRequestGet) requestGet).getCapteur()==null);
		((ConcreteMethodRequestGet) requestGet).setCapteur(new ConcreteCapteur());
		assertTrue(((ConcreteMethodRequestGet) requestGet).getCapteur()!=null);
	}

}
